local bowusheng = fk.CreateSkill {
    name = "bowusheng",
    tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
    ["bowusheng"] = "斩",
    [":bowusheng"] = "锁定技，你的杀造成伤害+1；若杀的目标已受伤则改成+2，且每造成1伤害摸1张手牌。",
    ["$bowusheng1"] = "以义传魂，以武入圣！",
    ["$bowusheng2"] = "义击逆流，武安黎庶！",
}

-- 增加杀的伤害逻辑封装
local function increaseSlashDamage(player, data)
    if not data.to then return end
    local extraDamage = 1
    local targetPlayer = data.to
    if targetPlayer.isWounded and targetPlayer:isWounded() then
        extraDamage = 2
    end
    data.damage = (data.damage or 0) + extraDamage
end

-- 造成伤害后摸牌
local function drawCards(player, data)
    local room = player.room
    if not room then return end
    
    local damage = data.damage
    if player.dead or damage <= 0 then return end
    
    player:drawCards(damage, bowusheng.name)
end

-- 合并技能效果
bowusheng:addEffect(fk.DamageCaused, {
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(bowusheng.name) 
               and data.card and data.card.trueName == "slash"
    end,
    on_use = function(self, event, target, player, data)
        increaseSlashDamage(player, data)
        drawCards(player, data)
    end,
})

return bowusheng